package com.hxtec.polaris.controller;

import com.hxtec.polaris.model.ShopUserEntity;
import com.hxtec.polaris.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Marcus lv
 * @create 2019/11/17 5:23 下午
 */
@RestController
@RequestMapping("user")
@Api(value = "/user", tags = "用户")
public class UserController {
    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }


    @GetMapping
    @ApiOperation(value = "获取用户信息")
    public ShopUserEntity getUser(){
        return userService.getUser();
    }

    @GetMapping("/verify/{number}")
    @ApiOperation(value = "获取验证码")
    public int verify(@PathVariable String number){
        return userService.verify(number);
    }

    @PostMapping("/bind")
    @ApiOperation(value = "绑定微信")
    public void bind(@RequestParam String openid){
        userService.bind(openid);
    }
}
